(function(ui){
	var fullScreen = ui.FullScreen = {
		init: function (xctr) {
			xctr.dom.addClass("ccay-fullscreen");
			if (!$("#ccay_fullscreen_overlay").length) {
				$('body').append('<div class="ccay-overlay" id="ccay_fullscreen_overlay" style="z-index: 993;display: none;"/>');
			}
		},
		execute: function (container, fullHeight, isFull) {
			container.manager().fullScreen && container.manager().fullScreen(container, fullHeight, isFull);
			container.find(".ccay-fullscreen").each(function () {
				$(this).manager().fullScreen(container, fullHeight, isFull);
			});
		}
	};
	
   	$.fn.fullScreen = function () {
		this.toggleClass("ccay-fullscreen-full ccay-dialog")
		$(document.documentElement).toggleClass("hidden-scroll");
		fullScreen.execute(this, this.height(), this.hasClass("ccay-fullscreen-full"));
	}
   	
})(Ccay.UI);